// StaticEx.cpp : implementation file
//

#include "stdafx.h"
#include "StaticEx.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CStaticEx

CStaticEx::CStaticEx()
{
	m_bTransparent = TRUE;
	m_crBkColor = ::GetSysColor( COLOR_BTNFACE );
	m_crTextColor = ::GetSysColor( COLOR_BTNTEXT );
}

CStaticEx::~CStaticEx()
{
}


BEGIN_MESSAGE_MAP(CStaticEx, CStatic)
	//{{AFX_MSG_MAP(CStaticEx)
	ON_WM_CTLCOLOR_REFLECT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStaticEx message handlers

HBRUSH CStaticEx::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	// TODO: Change any attributes of the DC here
    pDC->SetTextColor( m_crTextColor );
    pDC->SetBkColor( m_crBkColor );
	if( m_bTransparent )
		pDC->SetBkMode( TRANSPARENT );
	else
		pDC->SetBkMode( OPAQUE );
	return (HBRUSH)GetStockObject(NULL_BRUSH);
//	return (HBRUSH)GetStockObject(m_crBkColor);

	// TODO: Return a non-NULL brush if the parent's handler should not be called
//	return NULL;
}

void CStaticEx::SetBkColor(COLORREF crBkColor)
{
	m_crBkColor = crBkColor;
}

void CStaticEx::SetTextColor(COLORREF crTextColor)
{
	m_crTextColor = crTextColor;
}

void CStaticEx::SetTransparent(BOOL bTransparent)
{
	m_bTransparent = bTransparent;
}

